<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta content="origin" name="referrer" />

    <#--<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-a4bf54bef6fb.css" integrity="sha512-pL9Uvvb7LMqGC8jv/AyqZ7Ya6/HTgkhZzKwEsHOdsfaW2pr3fgzqjgKUSJfYkZ/klxwHrcu+tZwtNDTuw8vH6Q==" media="all" rel="stylesheet" />
    <link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-d5aa84dde2d5.css" integrity="sha512-1aqE3eLVo8QJ3AfkPFnOFkzBmHnOY5YYQ89j1V4ke28LRSpxHMVQecd6/XxAp5lGLPPSEaFNhLyGKHQHiFXT7w==" media="all" rel="stylesheet" />-->

   <#-- <link href="${basePath}/css/login/frameworks.css" rel="stylesheet">
    <link href="${basePath}/css/login/login.css" rel="stylesheet">-->

    <!--CDN-->
    <link href="https://dev-1253372767.file.myqcloud.com/frameworks.css" rel="stylesheet">
    <link href="https://dev-1253372767.file.myqcloud.com/login.css" rel="stylesheet">

    <meta name="viewport" content="width=device-width">

    <title>注册</title>
    <meta name="description" content="">

    <link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

</head>

<body class="logged-out env-production page-responsive min-width-0 session-authentication">


<div class="position-relative js-header-wrapper ">

    <div class="header header-logged-out width-full pt-5 pb-4" role="banner">
        <div class="container clearfix width-full text-center">
            <a class="header-logo" href="/" aria-label="Homepage">
                <i class="fa fa-dollar fa-4x"></i>
            </a>
        </div>
    </div>


</div>

<div role="main" class="application-main ">

    <div id="js-pjax-container">

        <div class="auth-form px-3" id="login">

            <form id="_form" action="" method="post">
                <div class="auth-form-header p-0"><h1>注册中心</h1></div>

                <div class="auth-form-body mt-3">
                    <label for="nickname">
                        昵称：
                    </label>
                    <input autofocus="autofocus" class="form-control input-block" id="nickname" name="nickname" tabindex="1" type="text"/>

                    <label for="email">
                        邮箱/账号：
                    </label>
                    <input autofocus="autofocus" class="form-control input-block" name="email"  id="email" tabindex="2" type="text"/>

                    <label for="password">
                        密码:
                    </label>
                    <input class="form-control form-control input-block" name="pswd" id="password" tabindex="3" type="password"/>

                    <label for="re_password">
                        确认密码:
                    </label>
                    <input class="form-control form-control input-block" id="re_password" tabindex="4" type="password"/>

                    <label for="re_password">
                        验证码:
                    </label>
                    <div id="vcode">
                        <input class="form-control form-control input-block" name="vcode" tabindex="5" type="password"/><img src="${basePath}/open/getGifCode.shtml" />
                    </div>
                    <button type="button" id="register" class="btn btn-primary btn-block" tabindex="6">注册</button>
                </div>
            </form>

            <p class="create-account-callout mt-3">
                <b><small>Tips:请勿恶意封禁删除账号,同IP多次恶意操作将加入黑名单.Thanks.</small></b>
            </p>
        </div>

    </div>
    <div class="modal-backdrop js-touch-events"></div>
</div>

<div class="footer container-lg p-responsive py-6 mt-6 f6" role="contentinfo">
    <ul class="list-style-none d-flex flex-justify-center">
        <li class="mr-3"><a href="https://surick.github.io/ssm-admin/">文档</a></li>
        <li class="mr-3"><a href="https://surick.github.io/">Blog</a></li>
        <li class="mr-3"><a href="https://gitee.com/surick/ssm-admin">码云</a></li>
        <li class="mr-3"><a href="https://github.com/surick/ssm-admin">GitHub</a></li>
    </ul>
</div>

<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="https://dev-1253372767.file.myqcloud.com/MD5.js"></script>
<script src="https://cdn.bootcss.com/layer/3.0.3/layer.min.js"></script>
<script >
    jQuery(document).ready(function() {
        //验证码
        $("#vcode").on("click",'img',function(){
            /**动态验证码，改变地址，多次在火狐浏览器下，不会变化的BUG，故这样解决*/
            var i = new Image();
            i.src = '${basePath}/open/getGifCode.shtml?'  + Math.random();
            $(i).replaceAll(this);
            //$(this).clone(true).attr("src",'${basePath}/open/getGifCode.shtml?'  + Math.random()).replaceAll(this);
        });
        $('#register').click(function(){
            var form = $('#_form');
            var error= form.find(".error");
            var tops = ['27px','96px','165px','235px','304px','372px'];
            var inputs = $("form :text,form :password");
            for(var i=0;i<inputs.length;i++){
                var self = $(inputs[i]);
                if(self.val() == ''){
                    layer.msg('请填写输入信息！');
                    self.focus();
                    return !1;
                }
            }
            var re_password = $("#re_password").val();
            var password = $("#password").val();
            if(password != re_password){
                return layer.msg('两次密码不匹配！',function(){}),!1;
            }

            if($('[name=vcode]').val().length !=4){
                return layer.msg('验证码为4位！',function(){}),!1;
            }
            var load = layer.load();
            $.post("${basePath}/u/subRegister.shtml",$("#_form").serialize() ,function(result){
                layer.close(load);
                if(result && result.status!= 200){
                    return layer.msg(result.message,function(){}),!1;
                }else{
                    layer.msg('注册成功！' );
                    window.location.href= result.back_url || "${basePath}/";
                }
            },"json");

        });


    });
</script>

</body>
</html>

